<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>五子棋</title>
  <link rel="stylesheet" href="./index.css">
</head>
<body>
  <!-- 棋盘 -->
  <div id="chess">
    <button id="resetBtn" class="reset-btn">重置</button>
  </div>

  <!-- 开始遮罩 -->
  <div id="cover" class="cover">
    <button id="startBtn" class="start-btn">点击开始</button>
  </div>

  <script type="module">
    import Canvas from './Canvas.js';
    import Board from './Board.js';

    // 创建画布
    const canvas = new Canvas('#chess');

    // 创建棋盘
    const board = new Board(canvas);
    board.draw();

    // 开始
    document.querySelector('#startBtn').addEventListener('click', () => {
      document.querySelector('#cover').style.display = 'none';
      board.start();
    });

    // 重置
    document.querySelector('#resetBtn').addEventListener('click', () => {
      board.reset();
    });
  </script>
</body>
</html>
